<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
   admin_Controller: muc dich check quyen
   
 */
class Admin_Controller extends CI_Controller {
	public function Admin_Controller()
	{	
		parent::__construct ();
		$this->load->helper('url');
		//Check quyen o day: Neu nhu dang nhap voi quyen admin thi
	   if(!$this->is_logined($this->session->userdata('sessionUserAdmin')))
		{
			$this->session->sess_destroy();
			redirect(base_url().'admin/index', 'location');
			die();
		}	
	}
    private function is_logined($user, $group='', $type = 'admin')
	{
		switch(strtolower($type))
		{
			case 'admin':
			    if($user && trim($user) != '' && $user ='thang' )
			    {
					return true;
			    }
			    break;
			case 'home':
			    if($user && trim($user) != '' && (int)$user > 0 && $group && trim($group) != '' && (int)$group > 0 && (int)$group < 4)
			    {
					return true;
			    }
			    break;
		}
		return false;
	}
	

}
// END _Controller class

/* End of file Controller.php */
/* Location: ./system/core/Admin_Controller.php */